package ru.gerunn.quartz;

import java.util.Date;

import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SimpleTrigger;
import org.quartz.impl.StdSchedulerFactory;

public class SimpleTriggerQuartzExample {

	public static void main(String[] args) {
		try {
			Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();

			JobDetail jobDetail = new JobDetail("jobName", "groupName", SimpleQuartzJob.class);
			SimpleTrigger simpleTrigger = new SimpleTrigger("triggerName", "triggerGroup");
			simpleTrigger.setStartTime(new Date());
			simpleTrigger.setRepeatInterval(1000);
			simpleTrigger.setRepeatCount(12);
			scheduler.scheduleJob(jobDetail, simpleTrigger);

			scheduler.start();
			//scheduler.shutdown();
		} catch (SchedulerException se) {
			se.printStackTrace();
		}
	}

}
